package com.itheima.stringjoinerdemo;

import java.util.StringJoiner;

public class StringJoinerDemo2 {
    public static void main(String[] args) {
        //1.创建对象
        StringJoiner sj = new StringJoiner(", ", "[", "]");

        //2.添加元素
        sj.add("aaa").add("bbb").add("ccc");

        //3.长度
        int length = sj.length();
        System.out.println(length);

        //4.转字符串
        System.out.println(sj.toString());
    }
}
